<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="lib.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python documentation Index' />
<link rel="first" href="lib.html" title='Python library Reference' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="next" href="module-imghdr.html" />
<link rel="prev" href="module-colorsys.html" />
<link rel="parent" href="mmedia.html" />
<link rel="next" href="module-imghdr.html" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name='aesop' content='information' />
<title>19.8 rgbimg -- Read and write ``SGI RGB'' files</title>
</head>
<body>
<div class="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="19.7 colorsys  "
  href="module-colorsys.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="19. multimedia Services"
  href="mmedia.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="19.9 imghdr  "
  href="module-imghdr.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="module-colorsys.html">19.7 colorsys  </a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="mmedia.html">19. Multimedia Services</a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="module-imghdr.html">19.9 imghdr  </a>
</div>
<hr /></div>
</div>
<!--End of Navigation Panel-->

<h1><a name="SECTION0021800000000000000000">
19.8 <tt class="module">rgbimg</tt> --
         Read and write ``SGI RGB'' files</a>
</h1>

<p>
<a name="module-rgbimg"></a>

<p>
<div class="versionnote"><b>Deprecated since release 2.5.</b>
This module is not maintained anymore and seems to be
                 unused.</div><p></p>

<p>
The <tt class="module">rgbimg</tt> module allows Python programs to access SGI imglib image
files (also known as <span class="file">.rgb</span> files).  The module is far from
complete, but is provided anyway since the functionality that there is
enough in some cases.  Currently, colormap files are not supported.

<p>
<span class="note"><b class="label">Note:</b>
This module is only built by default for 32-bit platforms; it is
not expected to work properly on other systems.</span>

<p>
The module defines the following variables and functions:

<p>
<dl><dt><b><span class="typelabel">exception</span>&nbsp;<tt id='l2h-4651' xml:id='l2h-4651' class="exception">error</tt></b></dt>
<dd>
This exception is raised on all errors, such as unsupported file type, etc.
</dd></dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-4652' xml:id='l2h-4652' class="function">sizeofimage</tt></b>(</nobr></td>
  <td><var>file</var>)</td></tr></table></dt>
<dd>
This function returns a tuple <code>(<var>x</var>, <var>y</var>)</code> where
<var>x</var> and <var>y</var> are the size of the image in pixels.
Only 4 byte RGBA pixels, 3 byte RGB pixels, and 1 byte greyscale pixels
are currently supported.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-4653' xml:id='l2h-4653' class="function">longimagedata</tt></b>(</nobr></td>
  <td><var>file</var>)</td></tr></table></dt>
<dd>
This function reads and decodes the image on the specified file, and
returns it as a Python string. The string has 4 byte RGBA pixels.
The bottom left pixel is the first in
the string. This format is suitable to pass to <tt class="function">gl.lrectwrite()</tt>,
for instance.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-4654' xml:id='l2h-4654' class="function">longstoimage</tt></b>(</nobr></td>
  <td><var>data, x, y, z, file</var>)</td></tr></table></dt>
<dd>
This function writes the RGBA data in <var>data</var> to image
file <var>file</var>. <var>x</var> and <var>y</var> give the size of the image.
<var>z</var> is 1 if the saved image should be 1 byte greyscale, 3 if the
saved image should be 3 byte RGB data, or 4 if the saved images should
be 4 byte RGBA data.  The input data always contains 4 bytes per pixel.
These are the formats returned by <tt class="function">gl.lrectread()</tt>.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-4655' xml:id='l2h-4655' class="function">ttob</tt></b>(</nobr></td>
  <td><var>flag</var>)</td></tr></table></dt>
<dd>
This function sets a global flag which defines whether the scan lines
of the image are read or written from bottom to top (flag is zero,
compatible with SGI GL) or from top to bottom (flag is one,
compatible with X).  The default is zero.
</dl>

<div class="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="19.7 colorsys  "
  href="module-colorsys.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="19. multimedia Services"
  href="mmedia.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="19.9 imghdr  "
  href="module-imghdr.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="module-colorsys.html">19.7 colorsys  </a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="mmedia.html">19. Multimedia Services</a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="module-imghdr.html">19.9 imghdr  </a>
</div>
</div>
<hr />
<span class="release-info">Release 2.5.1, documentation updated on 18th April, 2007.</span>
</div>
<!--End of Navigation Panel-->
<address>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</address>
</body>
</html>
